#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5;
typedef int LL;
LL n;
double x;
bool check(LL i,LL mid){
    if((1.0*i/(1.0*mid)<=x) ) return true;
    else return false;
}
LL bsearch(LL i){
    LL l=1;LL r=n;
    while(l<r){
        LL mid=(l+r)>>1;
     ///   debug(mid);
        if(check(i,mid)) r=mid;
        else l=mid+1;
    }
   /// debug(l);
    return l;
}
int main(void)
{
  scanf("%d",&n);
  scanf("%lf",&x);
  LL up=0;LL down=0;
  double eps=0x3f3f3f3f;
  for(LL i=1;i<=n;i++){
      LL d=bsearch(i);
    ////  debug(d);
      if( fabs( (1.0*i/(1.0*d)-x) ) < eps){
        eps=fabs(double(1.0*i/d)-x);
        up=i;
        down=d;
      }
  }
  LL gcd=__gcd(up,down);
  printf("%d\n",up/gcd);
  printf("%d\n",down/gcd);
return 0;
}
